<?php
/**
 * Created by JetBrains PhpStorm.
 * User: CAIXUDONG
 * Date: 11-6-16
 * Time: 下午4:06
 */
 
include '../bootstrap.php';

$_user = Model::getInstance('user');
$user_info = $_user->needLogin();

$type_name = $_input->post('type_name');

if(!$type_name){
    $data = array(
        "statusCode"=>"300",
        "message"=>"必须填写宝贝分类名",
    );
    echo Response::JSON($data);
    exit;
}

$parent_type_id = $_input->post('parent_type_id',0);
$is_show = $_input->post('is_show');
$type_id = $_input->post('type_id');

$ret = Model::getInstance('baobeitype')->updateBaoBeiType($type_id,$type_name,$parent_type_id,$is_show);

if($ret){

    $data = array(
        "statusCode"=>"200",
        "message"=>"更新成功",
        "navTabId"=>"baobeitype",
    );
    echo Response::JSON($data);
}else{

    $data = array(
        "statusCode"=>"300",
        "message"=>"更新失败",
    );
    echo Response::JSON($data);
}